/*
 * @Author: 九阳
 * @Date: 2021-11-18 14:24:57
 * @LastEditors: 李九阳
 * @LastEditTime: 2021-12-15 17:04:46
 */
// 存储，关闭浏览器删除
class SessionStorage {
  constructor() {}
  getSession(key: string) {
    return sessionStorage.getItem(key);
  }
  setSession(key: string, value: any) {
    return sessionStorage.setItem(key, value);
  }
  removeItem(key: string) {
    sessionStorage.removeItem(key);
  }
  clean() {
    sessionStorage.clear();
  }
}

export const session = new SessionStorage();
// local:永久存储，手动删除
class LocalStorage {
  constructor() {}
  getStorage(key: string) {
    return localStorage.getItem(key);
  }
  setStorage(key: string, value: any) {
    return localStorage.setItem(key, value);
  }
  removeItem(key: string) {
    localStorage.removeItem(key);
  }
  clean() {
    localStorage.clear();
  }
}

export const local = new LocalStorage();
